<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>IPGPS 访问追踪系统 - 导航中心</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            padding: 20px;
        }
        
        .container {
            max-width: 1200px;
            margin: 0 auto;
        }
        
        .header {
            text-align: center;
            color: white;
            margin-bottom: 40px;
        }
        
        .header h1 {
            font-size: 2.5rem;
            margin-bottom: 10px;
            text-shadow: 0 2px 4px rgba(0,0,0,0.3);
        }
        
        .header p {
            font-size: 1.2rem;
            opacity: 0.9;
        }
        
        .nav-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 30px;
            margin-bottom: 40px;
        }
        
        .nav-card {
            background: white;
            border-radius: 15px;
            padding: 30px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.1);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }
        
        .nav-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 15px 40px rgba(0,0,0,0.15);
        }
        
        .nav-card h2 {
            color: #333;
            margin-bottom: 15px;
            font-size: 1.5rem;
        }
        
        .nav-card p {
            color: #666;
            margin-bottom: 20px;
            line-height: 1.6;
        }
        
        .nav-links {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }
        
        .nav-link {
            display: inline-block;
            padding: 12px 20px;
            background: linear-gradient(135deg, #667eea, #764ba2);
            color: white;
            text-decoration: none;
            border-radius: 8px;
            transition: background 0.3s ease;
            text-align: center;
        }
        
        .nav-link:hover {
            background: linear-gradient(135deg, #5a6fd8, #6a4190);
        }
        
        .nav-link.secondary {
            background: #f8f9fa;
            color: #495057;
            border: 1px solid #dee2e6;
        }
        
        .nav-link.secondary:hover {
            background: #e9ecef;
        }
        
        .feature-list {
            list-style: none;
            margin: 15px 0;
        }
        
        .feature-list li {
            padding: 5px 0;
            color: #666;
            position: relative;
            padding-left: 20px;
        }
        
        .feature-list li::before {
            content: "✓";
            position: absolute;
            left: 0;
            color: #28a745;
            font-weight: bold;
        }
        
        .stats {
            background: white;
            border-radius: 15px;
            padding: 30px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.1);
            text-align: center;
        }
        
        .stats h3 {
            color: #333;
            margin-bottom: 20px;
        }
        
        .stat-item {
            display: inline-block;
            margin: 0 20px;
            padding: 20px;
            background: #f8f9fa;
            border-radius: 10px;
            min-width: 150px;
        }
        
        .stat-number {
            font-size: 2rem;
            font-weight: bold;
            color: #667eea;
        }
        
        .stat-label {
            color: #666;
            margin-top: 5px;
        }
        
        .embed-code {
            background: #f8f9fa;
            border: 1px solid #dee2e6;
            border-radius: 8px;
            padding: 15px;
            margin: 15px 0;
            font-family: 'Courier New', monospace;
            font-size: 14px;
            overflow-x: auto;
        }
        
        .warning {
            background: #fff3cd;
            border: 1px solid #ffeaa7;
            color: #856404;
            padding: 15px;
            border-radius: 8px;
            margin: 20px 0;
        }
        
        .warning strong {
            color: #856404;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>🚀 IPGPS 访问追踪系统</h1>
            <p>最小化数据收集 · 隐私优先 · 实时追踪</p>
        </div>

        <div class="nav-grid">
            <!-- 数据收集模块 -->
            <div class="nav-card">
                <h2>📊 数据收集</h2>
                <p>多种方式收集访问数据，支持GPS定位和隐私保护</p>
                <ul class="feature-list">
                    <li>匿名化IP地址</li>
                    <li>可选GPS位置追踪</li>
                    <li>User-Agent哈希</li>
                    <li>用户同意机制</li>
                </ul>
                <div class="nav-links">
                    <a href="index.php" class="nav-link">📱 访问诊断页</a>
                    <a href="pixel.php" class="nav-link secondary">🎯 像素追踪</a>
                </div>
            </div>

            <!-- 数据管理模块 -->
            <div class="nav-card">
                <h2>🔧 数据管理</h2>
                <p>查看、筛选、导出和分析收集的访问数据</p>
                <ul class="feature-list">
                    <li>按日期筛选数据</li>
                    <li>CSV格式导出</li>
                    <li>地理位置查看</li>
                    <li>数据清理功能</li>
                </ul>
                <div class="nav-links">
                    <a href="admin_file.php" class="nav-link">📁 文件存储管理</a>
                    <!-- <a href="admin.php" class="nav-link">🗄️ 数据库管理</a> -->
                </div>
            </div>

            <!-- 集成使用模块 -->
            <div class="nav-card">
                <h2>🔗 集成使用</h2>
                <p>将追踪系统集成到您的网站或应用中</p>
                <div class="embed-code">
                    &lt;!-- 像素追踪 --&gt;
                    &lt;img src="http://aifk.site/pixel.php" width="1" height="1" style="display:none"&gt;
                     <!--注意上面的.pixel.php链接地址，方面外站调用时需要修改为绝对路径-->
                </div>
                <div class="embed-code">
                    &lt;!-- JavaScript追踪 --&gt;
                    &lt;script src="http://aifk.site/wyzjs.js"&gt;&lt;/script&gt;
                    <!--注意上面的.JS链接地址，方面外站调用时需要修改为绝对路径-->
                </div>
                <div class="nav-links">
                    <a href="cs.html" class="nav-link secondary">📚 集成示例</a>
                    <a href="short.php" class="nav-link secondary">🔗 短链接测试</a>
                </div>
            </div>
        </div>

        <div class="warning">
            <strong>⚠️ 安全提醒：</strong>
            <p>
                本系统仅供学习和研究使用，请勿将追踪数据用于商业用途。
                <br>
                如需商用，请联系作者wsyh1024@qq.com！
            </p>
            <!-- 请及时修改 <code>config.php</code> 中的默认管理员密码和数据库配置！ -->
        </div>

        <div class="stats">
            <h3>📈 系统状态</h3>
            <div class="stat-item">
                <div class="stat-number" id="logCount">-</div>
                <div class="stat-label">今日记录</div>
            </div>
            <div class="stat-item">
                <div class="stat-number" id="fileCount">-</div>
                <div class="stat-label">日志文件</div>
            </div>
            <div class="stat-item">
                <div class="stat-number" id="lastUpdate">-</div>
                <div class="stat-label">最后更新</div>
            </div>
        </div>
    </div>

    <script>
        // 动态获取系统状态 - 使用专用API
        function updateStats() {
            fetch('api_stats.php')
                .then(response => response.json())
                .then(data => {
                    document.getElementById('logCount').textContent = data.today_count;
                    document.getElementById('fileCount').textContent = data.file_count;
                    document.getElementById('lastUpdate').textContent = data.current_time;
                })
                .catch(error => {
                    console.error('获取统计数据失败:', error);
                    document.getElementById('logCount').textContent = '-';
                    document.getElementById('fileCount').textContent = '-';
                    document.getElementById('lastUpdate').textContent = new Date().toLocaleTimeString('zh-CN');
                });
        }

        // 页面加载时立即更新状态
        updateStats();
        
        // 每5秒更新一次（实时更新）
        setInterval(updateStats, 5000);
        
        // 页面可见性改变时立即更新
        document.addEventListener('visibilitychange', function() {
            if (!document.hidden) {
                updateStats();
            }
        });
        
        // 页面激活时更新
        window.addEventListener('focus', updateStats);
    </script>
</body>
</html>